package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.mysql.fabric.Response;
import com.opensymphony.xwork2.ActionSupport;
import com.zr.service.CargostatusserviceCH;
import com.zr.service.UserService;

import net.sf.json.JSON;
import net.sf.json.JSONArray;

public class CargostatusActionCH extends ActionSupport implements ServletRequestAware,ServletResponseAware {
	private HttpServletRequest req;
	private HttpServletResponse resp;
	
	private int csId;
	private int packageId;
	private int orId;
	private String csCurrentLocation;
	private String csNextLocation;
	private String csCurrentDate;
	private int driverId;
	public int getCsId() {
		return csId;
	}
	public void setCsId(int csId) {
		this.csId = csId;
	}
	public int getPackageId() {
		return packageId;
	}
	public void setPackageId(int packageId) {
		this.packageId = packageId;
	}
	public int getOrId() {
		return orId;
	}
	public void setOrId(int orId) {
		this.orId = orId;
	}
	public String getCsCurrentLocation() {
		return csCurrentLocation;
	}
	public void setCsCurrentLocation(String csCurrentLocation) {
		this.csCurrentLocation = csCurrentLocation;
	}
	public String getCsNextLocation() {
		return csNextLocation;
	}
	public void setCsNextLocation(String csNextLocation) {
		this.csNextLocation = csNextLocation;
	}
	public String getCsCurrentDate() {
		return csCurrentDate;
	}
	public void setCsCurrentDate(String csCurrentDate) {
		this.csCurrentDate = csCurrentDate;
	}
	public int getDriverId() {
		return driverId;
	}
	public void setDriverId(int driverId) {
		this.driverId = driverId;
	}
	//属性注入
		@Resource
		private  CargostatusserviceCH csc;
	
	public void getAllCargostatus(){
		JSONArray  js=csc.getALLshowCargostatus();
		JSONArray jj=JSONArray.fromObject(js);
		try {
			resp.setCharacterEncoding("utf-8");
			PrintWriter pw=resp.getWriter();
			pw.write(jj.toString());	
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}
	
	
	
	
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.resp=arg0;
	}

	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		this.req=arg0;
	}

	
		
}
